class Stock:
    def __init__(self, stock_code):
        self.__stock_code = stock_code
        self.__total_shares = 0
        self.__total_cost = 0.0

    def get_stock_code(self):
        return self.__stock_code

    def get_total_shares(self):
        return self.__total_shares

    def get_total_cost(self):
        return self.__total_cost

    def purchase(self, shares, price_per_share):
        self.__total_shares += shares;
        self.__total_cost += shares * price_per_share

    def get_profit(self, current_price):
        market_value = self.__total_shares * current_price
        return market_value - self.__total_cost

class DividendStock(Stock):
    def __init__(self, stock_code):
        super().__init__(stock_code)
        self.__dividends = 0.0

    def pay_dividend(self, amount_per_share):
        self.__dividends += amount_per_share * super().get_total_shares();#注意super

    def get_profit(self, current_price):
        return super().get_profit(current_price) + self.__dividends#注意super

def main():
    stock_code = input()
    current_stock = DividendStock(stock_code)
    n = int(input())
    for i in range(n):
        num_shares, price_per_share = (float(x) for x in input().split())
        current_stock.purchase(num_shares, price_per_share)
    current_price = float(input())
    amount_per_share = float(input())
    current_stock.pay_dividend(amount_per_share)
    profit = current_stock.get_profit(current_price)
    print("Net profit/loss:", profit)

main()